package com.gticket.customerbackend.service.impl;

import com.gticket.customerbackend.mapper.ConsoleMapper;
import com.gticket.customerbackend.pojo.CinemaCode;
import com.gticket.customerbackend.pojo.CinemaHall;
import com.gticket.customerbackend.pojo.CinemaOriginalSeats;
import com.gticket.customerbackend.pojo.Cinemas;
import com.gticket.customerbackend.service.ConsoleService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Data
@Transactional
public class ConsoleServiceImpl implements ConsoleService {
    @Autowired
    private ConsoleMapper consoleMapper;


    @Override
    public List<Cinemas> getAllCinemas(CinemaCode CinemaCode) {
        return consoleMapper.getAllCinemas(CinemaCode);
    }

    @Override
    public List<CinemaHall> getCinemaHallByCid(CinemaCode CinemaCode, int cinema_id) {
        return consoleMapper.getCinemaHallByCid(CinemaCode,cinema_id);
    }

    @Override
    public CinemaOriginalSeats getCinemaOrignalSeats(CinemaCode cinemaCode, int os_id) {
        return consoleMapper.getCinemaOrignalSeats(cinemaCode,os_id);
    }

    @Override
    public void updateSeats(CinemaCode cinemaCode, int os_id, int row_id, String row_cnt) {
        consoleMapper.updateSeats(cinemaCode,os_id,row_id,row_cnt);
    }

    @Override
    public void updateCapacity(CinemaCode cinemaCode, int os_id, int ch_capacity) {
        consoleMapper.updateCapacity(cinemaCode,os_id,ch_capacity);
    }

    @Override
    public boolean createNewSeats(CinemaCode cinemaCode,int cinema_id,int ch_id) {
        return consoleMapper.createNewSeats(cinemaCode,cinema_id,ch_id);
    }

    @Override
    public int getOs_idByCh_id(CinemaCode cinemaCode, int ch_id) {
        return consoleMapper.getOs_idByCh_id(cinemaCode,ch_id);
    }

    @Override
    public void connectOS2CH(CinemaCode cinemaCode, int os_id, int ch_id) {
        consoleMapper.connectOS2CH(cinemaCode,os_id,ch_id);
    }

    @Override
    public boolean createNewCinemaHall(CinemaCode cinemaCode, String ch_name, int cinema_id) {
        return consoleMapper.createNewCinemaHall(cinemaCode,ch_name,cinema_id);
    }

    @Override
    public boolean createNewCinema(CinemaCode cinemaCode, String cinema_name, int company_id, String cinema_address) {
        return consoleMapper.createNewCinema(cinemaCode,cinema_name,company_id,cinema_address) ;
    }

    @Override
    public int getCinema_idBCh_id(CinemaCode cinemaCode, int ch_id) {
        return consoleMapper.getCinema_idBCh_id(cinemaCode, ch_id);
    }
}
